package com.ftm.service.impl;

import java.util.List;

import com.ftm.dao.UserDao;
import com.ftm.dao.impl.UserDaoImpl;
import com.ftm.entity.User;
import com.ftm.service.UserService;
import com.ftm.tools.MD5Util;

/**
 * 用户服务类
 * @author zcl
 *
 */
public class UserServiceImpl implements UserService {
	
	UserDao ud =new UserDaoImpl();

	@Override
	public User ULogin(String username, String pwd) {
		//将密码转换为密文
		String userpwd = MD5Util.getEncodeByMd5(pwd);
		User user = ud.userLogin(username, userpwd);
		if(user!=null)
			return user;
		return null;
	}

	@Override
	public List<User> getUser() {
		// TODO Auto-generated method stub
		return ud.getUser("");
	}
	
	@Override
	public User getUsersByName(String username) {
		// TODO Auto-generated method stub
		return ud.getUserByName(username);
	}

	@Override
	public boolean setUserState(String username, int state) {
		boolean f=ud.proUser(username, state);
		if(f) {
			return true;
		}
		return false;
	}
	

}
